package com.gxa.retail_admin.controller;

import com.gxa.common.vo.JsonResult;
import com.gxa.modules.pojo.Grade;
import io.swagger.annotations.*;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Date;

@Controller
@Api(value = "测试数据",tags = "会员积分—陈峰江")
public class GradeController {
    @GetMapping("/queryGrade")
    @ApiOperation(value = "积分查询接口",notes = "分页查询所有积分信息",httpMethod = "GET",response = JsonResult.class)
    @ApiResponses({
            @ApiResponse(code = 200,message = "查询成功"),
            @ApiResponse(code = 400,message = "参数接口问题"),
            @ApiResponse(code = 405,message = "方法不允许"),
            @ApiResponse(code = 500,message = "后端问题"),
    })
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page",value = "当前页码数",paramType = "query",dataType = "String"),
            @ApiImplicitParam(name = "limit",value = "每页显示条数",paramType = "query",dataType = "String")
    })
    @ResponseBody
    public JsonResult queryGrade(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer limit) {
        JsonResult r = new JsonResult();
        Grade grade =new Grade();
        grade.setGrade_id(1);
        grade.setGrade_number(100);
        r.setCode(200);
        r.setMsg("查询成功");
        r.setData(grade);
        return r;
    }

    /**
     * 订单号搜索
     * @param grade_number
     * @return
     */
    @GetMapping(value = "/searchGrade")
    @ApiOperation(value = "挂账单号搜索",notes = "按挂账订单号搜索",httpMethod = "GET", response = JsonResult.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page",value = "当前页码数,默认为1",paramType = "query",required = false,dataType ="String" ),
            @ApiImplicitParam(name = "pageSize",value = "每页显示条数,默认为10",paramType = "query",required = false,dataType ="String" ),
            @ApiImplicitParam(name = "account_number",value = "挂账单号搜索",paramType = "query",required = false,dataType ="String" )
    })
    @ApiResponses({
            @ApiResponse(code=200,message = "success"),
            @ApiResponse(code=404,message = "找不到页面，接口或参数错误"),
            @ApiResponse(code = 405,message = "方法不允许"),
            @ApiResponse(code=500,message = "后台错误"),
    })
    @ResponseBody
    public JsonResult searchGrade(Integer grade_number){
        JsonResult r = new JsonResult();
        Grade grade =new Grade();
        grade.setGrade_id(2);
        grade.setGrade_number(101);
        r.setCode(200);
        r.setMsg("查询成功");
        r.setData(grade);
        return r;
    }

    /**
     * 查询今日新增
     * @param currentPage
     * @param pageSize
     * @return
     */
    @GetMapping(value = "/queryTodayGrade")
    @ApiOperation(value = "今日新增接口",notes = "查询今日新增订单",httpMethod = "GET", response = JsonResult.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage",value = "当前页码数",paramType = "query",dataType = "String",required = false),
            @ApiImplicitParam(name = "pageSize",value = "每页显示条数",paramType = "query",dataType = "String",required = false),
    })
    @ApiResponses({
            @ApiResponse(code=200,message = "success"),
            @ApiResponse(code=404,message = "找不到页面，接口或参数错误"),
            @ApiResponse(code=405,message = "方法不允许"),
            @ApiResponse(code=500,message = "后台错误"),
    })
    @ResponseBody
    public JsonResult queryTodayGrade(@RequestParam(defaultValue = "1")Integer currentPage,@RequestParam(defaultValue = "10")Integer pageSize) {
        JsonResult r = new JsonResult();
        Grade grade =new Grade();
        grade.setGrade_id(3);
        grade.setGrade_number(1021);
        r.setCode(200);
        r.setMsg("查询成功");
        r.setData(grade);
        return r;

    }
    /**
     * 查询昨日新增
     * @param currentPage
     * @param pageSize
     * @return
     */
    @GetMapping(value = "/queryYesterdayGrade")
    @ApiOperation(value = "昨日新增接口",notes = "查询昨日新增订单",httpMethod = "GET", response = JsonResult.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage",value = "当前页码数",paramType = "query",dataType = "String",required = false),
            @ApiImplicitParam(name = "pageSize",value = "每页显示条数",paramType = "query",dataType = "String",required = false),
    })
    @ApiResponses({
            @ApiResponse(code=200,message = "success"),
            @ApiResponse(code=404,message = "找不到页面，接口或参数错误"),
            @ApiResponse(code=405,message = "方法不允许"),
            @ApiResponse(code=500,message = "后台错误"),
    })
    @ResponseBody
    public JsonResult queryYesterdayGrade(@RequestParam(defaultValue = "1")Integer currentPage,@RequestParam(defaultValue = "10")Integer pageSize) {
        JsonResult r = new JsonResult();
        Grade grade =new Grade();
        grade.setGrade_id(4);
        grade.setGrade_number(103);
        r.setCode(200);
        r.setMsg("查询成功");
        r.setData(grade);
        return r;

    }

    /**
     * 查询本周
     * @param currentPage
     * @param pageSize
     * @return
     */
    @GetMapping(value = "/queryWeekGrade")
    @ApiOperation(value = "本周新增接口",notes = "查询本周新增订单",httpMethod = "GET", response = JsonResult.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage",value = "当前页码数",paramType = "query",dataType = "String",required = false),
            @ApiImplicitParam(name = "pageSize",value = "每页显示条数",paramType = "query",dataType = "String",required = false),
    })
    @ApiResponses({
            @ApiResponse(code=200,message = "success"),
            @ApiResponse(code=404,message = "找不到页面，接口或参数错误"),
            @ApiResponse(code=405,message = "方法不允许"),
            @ApiResponse(code=500,message = "后台错误"),
    })
    @ResponseBody
    public JsonResult queryWeekGrade(@RequestParam(defaultValue = "1")Integer currentPage,@RequestParam(defaultValue = "10")Integer pageSize){
        JsonResult r = new JsonResult();
        Grade grade =new Grade();
        grade.setGrade_id(5);
        grade.setGrade_number(104);
        r.setCode(200);
        r.setMsg("查询成功");
        r.setData(grade);
        return r;
    }

    /**
     * 查询本月新增
     * @param currentPage
     * @param pageSize
     * @return
     */
    @GetMapping(value = "/queryMonthGrade")
    @ApiOperation(value = "本月新增接口",notes = "查询本月新增订单",httpMethod = "GET", response = JsonResult.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage",value = "当前页码数",paramType = "query",dataType = "String",required = false),
            @ApiImplicitParam(name = "pageSize",value = "每页显示条数",paramType = "query",dataType = "String",required = false),
    })
    @ApiResponses({
            @ApiResponse(code=200,message = "success"),
            @ApiResponse(code=404,message = "找不到页面，接口或参数错误"),
            @ApiResponse(code=405,message = "方法不允许"),
            @ApiResponse(code=500,message = "后台错误"),
    })
    @ResponseBody
    public JsonResult queryMonthGrade(@RequestParam(defaultValue = "1")Integer currentPage,@RequestParam(defaultValue = "10")Integer pageSize){
        JsonResult r = new JsonResult();
        Grade grade =new Grade();
        grade.setGrade_id(6);
        grade.setGrade_number(105);
        r.setCode(200);
        r.setMsg("查询成功");
        r.setData(grade);
        return r;
    }

    /**
     * 时间段查询订单
     * @param beforeTime
     * @param afterTime
     * @return
     */
    @GetMapping(value = "/queryBetweenTimeGrade")
    @ApiOperation(value = "范围时间查询",notes = "查询范围时间订单",httpMethod = "GET", response = JsonResult.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "beforeTime",value = "前一个时间",paramType = "query",dataType = "String",required = false),
            @ApiImplicitParam(name = "afterTime",value = "后一个时间",paramType = "query",dataType = "String",required = false),
    })
    @ApiResponses({
            @ApiResponse(code=200,message = "success"),
            @ApiResponse(code=404,message = "找不到页面，接口或参数错误"),
            @ApiResponse(code=405,message = "方法不允许"),
            @ApiResponse(code=500,message = "后台错误"),
    })
    @ResponseBody
    public JsonResult queryBetweenTimeGrade(Date beforeTime, Date afterTime){
        JsonResult r = new JsonResult();
        Grade grade =new Grade();
        grade.setGrade_id(7);
        grade.setGrade_number(106);
        r.setCode(200);
        r.setMsg("查询成功");
        r.setData(grade);
        return r;
    }
}
